<template>
    <d2-container class="AdvSearch" type="full">
        <adv-search :fields="fields" @normal="onNormalSearch" @adv="onAdvSearch" />
    </d2-container>
</template>
<script>
export default {
    name: "AdvSearchTest",
    data() {
        return {
            fields: [
                { value: "userName", label: "用户名", default: true },
                { value: "nickName", label: "昵称", type: "string" },
                {
                    value: "age",
                    label: "年龄",
                    type: "number",
                    config: { precision: 3, max: 20, min: 10 },
                },
                {
                    value: "sex",
                    label: "性别",
                    type: "bool",
                    config: { options: { active: "男", inactive: "女" } },
                },
                {
                    value: "status",
                    label: "状态",
                    type: "select",
                    config: {
                        options: [
                            { label: "新建", value: "1" },
                            { label: "执行中", value: "2" },
                            { label: "已完成", value: "3" },
                        ],
                    },
                },
                {
                    value: "createdTime",
                    label: "创建时间",
                    type: "date",
                    // operator: "daterange",
                    config: {
                        type: "daterange",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                    },
                },
            ],
        };
    },
    computed: {},
    methods: {
        onNormalSearch(dynamicFilter) {
            console.log(" onNormalSearch.dynamicFilter", dynamicFilter);
        },
        // 高级查询
        onAdvSearch(dynamicFilter) {
            console.log(" onAdvSearch.dynamicFilter", dynamicFilter);
        },
    },
};
</script>
<style>
</style>